package feeinterface.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.ulwx.tool.DateTime;
import com.ulwx.tool.DbUtils;

import feeinterface.modeldb.ServiceCoOpenHour;

public class ServiceCoOpenHourDao {

	
	public static List<ServiceCoOpenHour>  getBy(int CoID)throws Exception{
		
		String sql = "select * from ServiceCoOpenHour where ServiceCoID=? ";
		List<ServiceCoOpenHour> list = DbUtils.doQueryClass(null, ServiceCoOpenHour.class,
				sql,null);
		return list;
	}
	/**
	 * 当前时段是否被屏蔽
	 * @param CoID
	 * @return true:在屏蔽时段内  false：在开通时段内
	 * @throws Exception
	 */
	public static boolean IsCloseInCurHour(int CoID)throws Exception{
		

		String sql = "select * from ServiceCo a,ServiceCoOpenHour b " +
				" where a.ServiceCoSno=b.ServiceCoID and b.ServiceCoID=?" +
				" and a.Enable=1 and b.OpenHour= "+new DateTime().getHours();
		
		Map<Integer, Object> map = new HashMap<Integer, Object>();
		map.put(1, CoID);
		List<ServiceCoOpenHour> list = DbUtils.doQueryClass(null, ServiceCoOpenHour.class,
				sql,map);
		if (list.size() > 0)
			return false;
		return true;
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		System.out.println(new DateTime().getHours());

	}

}
